/*
 * @Description: Test02ArrayUtil
 * @Author: rendc
 * @Date: 2024-09-04 11:24:10
 * @LastEditors: rendc
 * @LastEditTime: 2024-09-04 14:51:27
 */
import java.util.Arrays;
public class Test02ArrayUtil{
  // main
  public static void main(String[] args){
    int[] array = {1,2,3,4,5,6,7,8}; // 8
    System.out.println("array: " + array);
    // 获得数组的字符串输出
    // String arrayStr = Arrays.toString(array);
    // System.out.println("arrayStr : " + arrayStr);
    System.out.println("array.length : " + array.length);// 8
    // 拷贝数组
    array = Arrays.copyOf(array,10);
    System.out.println("array: " + array);
    System.out.println("array.length : " + array.length);// ?10
    System.out.println("Arrays.toString(array) : " + Arrays.toString(array));// ...8,0,0
    // 数组排序
    // int[] arr1 = {1,3,5,2,4,6,7,8,9,10,15};
    // System.out.println("Arrays.toString(arr1) : " + Arrays.toString(arr1));
    // System.out.println("排序");
    // Arrays.sort(arr1);// 是否有返回值：没有 是否改变原数组：改变
    // System.out.println("Arrays.toString(arr1) : " + Arrays.toString(arr1));
    // String[] arr1 = {"1","3","12","10","7","5","20","2","30",};
    // System.out.println("Arrays.toString(arr1) : " + Arrays.toString(arr1));
    // System.out.println("排序");
    // Arrays.sort(arr1);// 是否有返回值：没有 是否改变原数组：改变
    // System.out.println("Arrays.toString(arr1) : " + Arrays.toString(arr1));
    // fill
    int[] arr1 = {1,3,5,2,4,6,7,8,9,10};
    System.out.println("Arrays.toString(arr1) : " + Arrays.toString(arr1));
    Arrays.fill(arr1,10);// 是否有返回值：没有 是否改变原数组：改变
    System.out.println("Arrays.toString(arr1) : " + Arrays.toString(arr1));
  }
}